<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>组件配置配置-checkboxgroup1</title>
        <{$showjs}>
        <link rel="stylesheet" type="text/css" href="../css/main1.css" />
        <style>
            .x-check-group-alt {
                background: #D1DDEF;
                border-top:1px dotted #B5B8C8;
                border-bottom:1px dotted #B5B8C8;
            }
            .float-left{float:left;width:100px;}
        </style>
        <script language="javascript">
            Ext.onReady(function(){
                Ext.QuickTips.init();
                Ext.form.Field.prototype.msgTarget = 'qtip';
                var myMask = new Ext.LoadMask(Ext.getBody(), {
                    msg: '请稍候...',
                    removeMask: true //完成后移除
                });
                var fp = new Ext.FormPanel({
                    frame: true,
                    //        title:'权限组设置 [Right Group Config]',
                    labelWidth: 110,
                    width: Ext.getBody().getWidth(),
                    renderTo:'form-ct',
                    bodyStyle: 'padding:0 10px 0;',
        
                    items: [{
                            xtype:'fieldset',
                            title: '自身配置',
                            autoHeight: true,
                            layout: 'form',
                            items: [{
                                    xtype: 'textfield',
                                    name: 'width',
                                    fieldLabel: '宽度',
                                    itemCls: 'x-check-group-alt',
                                    value:'<{if $fld.width==''}>50<{else}><{$fld.width}><{/if}>',
                                    width:'80px'
                                },{
                                    xtype: 'textfield',
                                    name: 'ts',
                                    fieldLabel: '提示语',
                                    value:'<{if $fld.ts==''}><{$fld.name}>不能为空!<{else}><{$fld.ts}><{/if}>',
                                    anchor: '95%'
                                },{
                                    xtype: 'checkboxgroup',
                                    fieldLabel: '打勾配置',
                                    itemCls: 'x-check-group-alt',
                                    items: [
                                        {boxLabel: '允许为空', name: 'yxwk',inputValue:1<{if $fld.yxwk=='1'}>,checked: true<{/if}>},
                                        {boxLabel: '高级搜索', name: 'gj',inputValue: 1<{if $fld.gj=='1'}>,checked: true<{/if}>},
                                        {boxLabel: '转译打开', name: 'zy',inputValue: 1<{if $fld.zy=='1'}>,checked: true<{/if}>},
                                        {boxLabel: '屏蔽显示', name: 'xr',inputValue:1<{if $fld.xr=='1'}>,checked: true<{/if}>}
                                    ]
                                }]
                        },{
                            xtype:'fieldset',
                            title: '虚拟参数设置',
                            autoHeight: true,
                            items: [{
                                    itemCls: 'x-check-group-alt',
                                    allowBlank: false,
                                    layout:'form',
                                    items: [{
                                            xtype: 'textarea',
                                            fieldLabel: 'STR[JSON]{,结尾,否则不显示,此处是EXTJS式的JSON配置.}',
                                            name:'cfg[STR]',
                                            width:490,
                                            value:'<{$cfg.STR}>'
                                        }]
                                }]
                        },{
                            xtype:'fieldset',
                            title: '数据库配置',
                            autoHeight: true,
                            items: [{
                                    itemCls: 'x-check-group-alt',
                                    allowBlank: false,
                                    layout:'column',
                                    items: [{
                                            columnWidth: '.33',
                                            bodyStyle: 'padding:0 10px 0;',
                                            labelWidth:60,
                                            layout:'form',
                                            items: [{
                                                    html:"<font color='red'><b>数据库表配置<hr></b></font>"
                                                },{
                                                    xtype: 'textfield',
                                                    name: 'cfg[table]',
                                                    fieldLabel: '所用表',
                                                    value:"<{$cfg.table}>",
                                                    width:'80px'
                                                },
                                                {
                                                    xtype: 'textfield',
                                                    name: 'cfg[conditon]',
                                                    fieldLabel: '查询条件',
                                                    value:"<{$cfg.conditon}>",
                                                    width:'80px'}]
                                        },{
                                            columnWidth: '.33',
                                            bodyStyle: 'padding:0 10px 0;',
                                            labelWidth:60,
                                            layout:'form',
                                            items: [{
                                                    html:"<font color='red'><b>字段配置<hr></b></font>"
                                                },{
                                                    xtype: 'textfield',
                                                    name: 'cfg[x]',
                                                    fieldLabel: '显示字段',
                                                    value:"<{$cfg.x}>",
                                                    width:'80px'},
                                                {
                                                    xtype: 'textfield',
                                                    name: 'cfg[y]',
                                                    fieldLabel: '值字段',
                                                    value:"<{$cfg.y}>",
                                                    width:'80px'}]
                                        },{
                                            columnWidth: '.33',
                                            bodyStyle: 'padding:0 10px 0;',
                                            labelWidth:60,
                                            layout:'form',
                                            items: [{
                                                    html:"<font color='red'><b>默认配置<hr></b></font>"
                                                },{
                                                    xtype: 'textfield',
                                                    name: 'cfg[dx]',
                                                    fieldLabel: '默认显示',
                                                    value:"<{$cfg.dx}>",
                                                    width:'80px',
                                                    disabled:true
                                                },{
                                                    xtype: 'textfield',
                                                    name: 'cfg[dy]',
                                                    fieldLabel: '默认值',
                                                    value:"<{$cfg.dy}>",
                                                    width:'80px',
                                                    disabled:true
                                                },{
                                                    xtype: 'hidden',
                                                    name: 'id',
                                                    value:'<{$fld.id}>'},{
                                                    xtype: 'hidden',
                                                    name: 'type',
                                                    value:'<{$fld.type}>'}]
                                        }]
                                }]}],

        
                    buttons: [{
                            text: '保存',
                            handler: function(){
                                if(fp.getForm().isValid()){
                                    //Ext.Msg.alert('Submitted Values',fp.getForm().getValues(true).replace(/&/g,', '));
                                    myMask.show();
                                    fp.form.doAction('submit',{
                                        url:'fldcfg.php',
                                        method:'POST',
                                        params:{op:'save'},
                                        waitMsg:'正在提交....',
                                        success:function (response){
                                            myMask.hide();
                                            parent.Ext.getCmp('<{$fld.id}>').close();
                                        },
                                        failure:function (response){
                                            Ext.MessageBox.alert('信息提示','提交失败');
                                        }
                                    });

                                }
                            }
                        },{
                            text: 'Reset',
                            handler: function(){
                                fp.getForm().reset();
                            }
                        }]
                });
            });
        </script>
    </head>
    <body>
        <div id="form-ct"></div>
    </body>
</html>
